<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<!-- 引入 layui.css -->
<link rel="stylesheet" href="/hospital_system/layui-v2.6.8/layui/css/layui.css"/>
<!-- 引入 layui.js -->
<script src="/hospital_system/layui-v2.6.8/layui/layui.js"></script>
</head>
<body>
<%String work=(String)request.getAttribute("work"); %>
<%String ysid=(String)request.getAttribute("ysid"); %>
<div id="test7" class="demo-transfer"></div>
 <div class="layui-btn-container">
  <button type="button" class="layui-btn" lay-demotransferactive="getData">获取右侧数据</button>
  
</div>
            
          

<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<script>
layui.use(['transfer', 'layer', 'util'], function(){
  var $ = layui.$
  ,transfer = layui.transfer
  ,layer = layui.layer
  
  ,util = layui.util;
  
  //模拟数据
  var data1 = [
    {"value": "1", "title": "周一"}
    ,{"value": "2", "title": "周二"}
    ,{"value": "3", "title": "周三"}
    ,{"value": "4", "title": "周四"}
    ,{"value": "5", "title": "周五"}
    ,{"value": "6", "title": "周六"}
   
  ]
  
 
  //实例调用
  transfer.render({
    elem: '#test7'
    ,data: data1
    ,title: ['未出诊', '出诊']
  ,value:["1", "3", "5"]
    ,id: 'key123' //定义唯一索引
  })
  //批量办法定事件
  util.event('lay-demoTransferActive', {
    getData: function(othis){
      var getData = transfer.getData('key123'); //获取右侧数据
      var json=JSON.stringify(getData);
      var fh="";
      for (var i = 0; i < JSON.stringify(getData).length; i++) {
			fh+=JSON.stringify(getData)[i].value; //迭代取出类别数据并填入类别数组
		}
    //  layer.alert(JSON.stringify(getData)[0].value); 
      location.href="/hospital_system/tjpbController?work="+JSON.stringify(getData)+"&ysid="+<%=(String)request.getAttribute("ysid") %>; 
      
    }
    
  });
  
});
</script>

</body>
</html>